using System;
using System.Data;
using System.Data.SqlClient; 

/// <summary>
/// Summary description for SqlServerTransaction
/// </summary>
public partial class SqlServerProvider
{
    #region	 ExecuteNonQuery
    public int ExecuteNonQuery()
    {
        sqlCommand = new SqlCommand();
        sqlCommand.CommandText = commandText;
        sqlCommand.Connection = sqlConnection;
        sqlCommand.CommandType = commandType;
        if(ParameterCollection.Length>0)
            AddParameters(sqlCommand);

        int rows = sqlCommand.ExecuteNonQuery();
        if(returnValueParameter != -1)
            returnValue = Convert.ToInt32(
            sqlCommand.Parameters[
            returnValueParameter].Value);
        sqlCommand.Dispose();
        return rows;

    }
     
    #endregion

    #region ExecuteScalar

    public object ExecuteScalar( )
    {
        sqlCommand = new SqlCommand();
        sqlCommand.CommandText = commandText;
        sqlCommand.Connection = sqlConnection;
        sqlCommand.CommandType = commandType;

        if (ParameterCollection!=null)
            AddParameters(sqlCommand);

        object obj = sqlCommand.ExecuteScalar();
        
        if (returnValueParameter != -1)
            returnValue = Convert.ToInt32(
            sqlCommand.Parameters[
            returnValueParameter].Value);
            
        sqlCommand.Dispose();
        return obj;
    }

     
    #endregion
}
